const EventEmitter = require('events')
const myEmitter = new EventEmitter()

myEmitter.on('event', (item) => {
  console.log(5)  
})

const printAwait = async () => {
  await console.log(6)
  await console.log(7)
  await console.log(10)
  await Promise.resolve().then(() => console.log(11))
  await Promise.resolve().then(() => console.log(12))
}

const printPromise = async () => {
  await Promise.resolve().then(() => console.log(8))
  await Promise.resolve().then(() => console.log(9))
}

setImmediate(() => {
  console.log(4)
}, 0)

setTimeout(() => {
  console.log(1)
}, 0)

Promise.resolve().then(() => {
  console.log(2)
})

process.nextTick(() => {
  console.log(3)
})

printAwait()
printPromise()
myEmitter.emit('event')